package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.SystemMessage;
import cn.wolfcode.trip.base.service.ISystemMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("systemMessages")
public class SystemMessageController {
    @Autowired
    private ISystemMessageService systemMessageService;

    @GetMapping("/{state}")
    public Object list(@PathVariable Integer state){
        List<SystemMessage> systemMessages = systemMessageService.selectAll(state);
        return systemMessages;
    }

    @PutMapping
    public void changeState(int state,Long systemMessageId){
        systemMessageService.changeState(state, systemMessageId);
    }

}
